package com.zeei.ems.base.controller;

import java.util.List;

import javax.annotation.Resource;

import com.zeei.ems.base.result.ResultRowsVO;
import com.zeei.ems.base.service.DeptInfoService;
import com.zeei.ems.base.tree.TreeNodeVO;
import com.zeei.ems.base.vo.DeptInfoVO;
import com.zeei.ems.base.vo.QueryDeptParamVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Api(tags = "部门管理接口")
@Controller
@RequestMapping("/ems/dept")
public class DeptInfoController extends BasicController {

	@Resource
	DeptInfoService deptInfoService;

	@ApiOperation(value = "查询部门树形列表")
	@RequestMapping(value = "/list", method = RequestMethod.POST)
	@ResponseBody
	public ResultRowsVO<TreeNodeVO<DeptInfoVO>> queryDept(QueryDeptParamVO queryDeptParam) {
		List<TreeNodeVO<DeptInfoVO>> list = deptInfoService.queryDeptInfo(queryDeptParam);
		return this.createResultRowsVO(list, true, null, list.size());
	}
}
